package com.wzz.controller;

import com.wzz.pojo.Product;
import com.wzz.pojo.vo.PageInfoVo;
import com.wzz.pojo.vo.R;
import com.wzz.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author DarkClown
 * @date 2024-08-05 09:27
 * @project_name day0805-week3
 * @parem
 **/
@RequestMapping("/list/list")
@RestController
public class ListController {
    @Autowired
    ProductService productService;

    /**
     * 列表   分页   条件查询
     * @param pageInfoVo
     * @return
     */
    @RequestMapping("/selectList")
    private R selectList(@RequestBody PageInfoVo pageInfoVo){
        return productService.selectList(pageInfoVo);
    }

    /**
     * 查询生成方式
     * @return
     */
    @RequestMapping("/selectFormat")
    private R selectFormat(){
        return productService.selectFormat();
    }

    /**
     * 添加
     */
    @RequestMapping("/insertProduct")
    private R insertProduct(@RequestBody Product product){
        return productService.insertProduct(product);
    }

    /**
     * 预览
     */
    @RequestMapping("/selectPro/{id}")
    private R selectPro(@PathVariable("id") Integer id){
        return productService.selectPro(id);
    }

}
